/**
 * Copyright 2010-2011, Thotpot Inc.
 */
package it.rainbowbreeze.polygen.data;

import it.rainbowbreeze.libs.data.RainbowAppPreferencesDao;
import android.content.Context;
import android.content.SharedPreferences;

/**
 * Main application preferences data storage
 * 
 * @author Alfredo "Rainbowbreeze" Morresi
 */
public class AppPreferencesDao
    extends RainbowAppPreferencesDao
{
    // ------------------------------------------ Private Fields
    
    private static final String PROP_PUSHDEVICETOKEN = "pushDeviceToken";
    

    // -------------------------------------------- Constructors
    public AppPreferencesDao(Context context, String preferenceKey) {
        super(context, preferenceKey);
    }


    // --------------------------------------- Public Properties

    
    // ------------------------------------------ Public Methods
    public String getPushDeviceToken()
    { return mSettings.getString(PROP_PUSHDEVICETOKEN, ""); }
    public void setPushDeviceToken(String newValue)
    { mEditor.putString(PROP_PUSHDEVICETOKEN, newValue); }


    // ----------------------------------------- Private Methods
    /* (non-Javadoc)
     * @see com.angurialab.postino.data.BasePreferencesDao#backupProperties()
     */
    @Override
    protected void backupProperties(SharedPreferences.Editor editorBackup) {
        editorBackup.putString(PROP_PUSHDEVICETOKEN, getPushDeviceToken());
    }

    /* (non-Javadoc)
     * @see com.angurialab.postino.data.BasePreferencesDao#restoreProperties()
     */
    @Override
    protected void restoreProperties(SharedPreferences settingsBackup) {
        setPushDeviceToken(settingsBackup.getString(PROP_PUSHDEVICETOKEN, ""));
    }
}